package com.kantboot.idsu.common.mapper;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 
 */
@Mapper
public interface IdsuCommonMapper {

    @Delete("UPDATE ${tableName} SET is_delete = 1 WHERE id = #{id}")
    Integer deleteById(@Param("tableName") String tableName, @Param("id") Long id);

    @Select("SELECT * FROM ${tableName} WHERE is_delete = 0 AND id = #{id}")
    HashMap<String,Object> selectById(@Param("tableName") String tableName, @Param("id") Long id);

    @Select("SELECT * FROM ${tableName} WHERE is_delete = 0 AND user_id = #{userId}")
    List<HashMap<String,Object>> selectByUserId(@Param("tableName") String tableName, @Param("userId") Long userId);

}
